package com.mj.text;

import java.util.Arrays;
import java.util.List;

/**
 * @Author：作者姓名
 * @Package：com.mj.text
 * @Project：g6_jdk1.8tz
 * @name：Statsthree
 * @Date：2024/5/22 9:34
 */
public class Statsthree {
    public static void main(String[] args) {
        /**
         * 简单结果终止方法：count,anyMatch,findFirst
         */

        List<String> ids = Arrays.asList("102", "304", "34", "98", "765", "222", "222");

        System.out.println(ids.stream().filter(s ->s.length()>2).count());

        // 判断是否有元素值等于222
        System.out.println(ids.stream().anyMatch("222"::equalsIgnoreCase));
        //findFirst操作
        ids.stream().filter(s -> s.length()>2)
                .findFirst()
                .ifPresent(s -> System.out.println("findFrst:"+s));
    }





}
